import request from '../utils/request';

enum apiList {
    'getSlideshow' = 'getSlideshow', // => SlideshowInfoList
    'getRecommendLine' = 'getRecommendLine', // => FpRecommendLines 分类推荐
    'v2/getRecommend' = 'v2/getRecommend', // => Cards
    'getDailyListen' = 'getDailyListen', // => dailyListenCategoryList
    'guessYouLike' = 'guessYouLike', // => RecommendInfoList
}

interface DailyListenCategoryList {
    categoryName: string;
    trackList: TrackList[];
}

interface TrackList {
    trackId: number;
    uid: number;
    title: string;
    isPaid: boolean;
    isFree: boolean;
    coverSmall: string;
    albumId: number;
    albumTitle: string;
    categoryId: number;
    trackUrl: string;
}

export interface DayListenData {
    dailyListenCategoryList: DailyListenCategoryList[];
}

export type ExploreApi = { [key in apiList]: () => any };

const exploreApi: ExploreApi = {} as ExploreApi;

Object.values(apiList).forEach((api) => {
    exploreApi[api] = async () => {
        return request.get(`/explore/${api}`);
    };
});


export default exploreApi;